/****************************************************************************************
This file is part of Proactive Investigator Analytics.

Proactive Investigator Analytics is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Proactive Investigator Analytics is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Proactive Investigator Analytics.  If not, see <http://www.gnu.org/licenses/>.

This script creates DHCP staging tables and indexes for partition switch purpose.

****************************************************************************************/

USE RiskSecurityDW
GO

/****** Object:  Table [dbo].[stg_fact_dhcp_9]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[stg_fact_dhcp_9](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_stg_fact_dhcp_9] ON [dbo].[stg_fact_dhcp_9] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO

/****** Object:  Table [dbo].[stg_fact_dhcp_8]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[stg_fact_dhcp_8](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_stg_fact_dhcp_8] ON [dbo].[stg_fact_dhcp_8] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[stg_fact_dhcp_7]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[stg_fact_dhcp_7](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_stg_fact_dhcp_7] ON [dbo].[stg_fact_dhcp_7] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[stg_fact_dhcp_6]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[stg_fact_dhcp_6](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_stg_fact_dhcp_6] ON [dbo].[stg_fact_dhcp_6] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[stg_fact_dhcp_5]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[stg_fact_dhcp_5](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_stg_fact_dhcp_5] ON [dbo].[stg_fact_dhcp_5] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[stg_fact_dhcp_4]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[stg_fact_dhcp_4](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_stg_fact_dhcp_4] ON [dbo].[stg_fact_dhcp_4] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[stg_fact_dhcp_3]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[stg_fact_dhcp_3](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_stg_fact_dhcp_3] ON [dbo].[stg_fact_dhcp_3] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[stg_fact_dhcp_2]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[stg_fact_dhcp_2](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_stg_fact_dhcp_2] ON [dbo].[stg_fact_dhcp_2] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[stg_fact_dhcp_1]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[stg_fact_dhcp_1](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_stg_fact_dhcp_1] ON [dbo].[stg_fact_dhcp_1] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[stg_fact_dhcp_0]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[stg_fact_dhcp_0](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_stg_fact_dhcp_0] ON [dbo].[stg_fact_dhcp_0] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO